def isAnagram(str1, str2): # DO NOT modify this line 
    # TODO: add your code here
    l1=list(str1)
    l2=list(str2)
    ll1=sorted(l1)
    ll2=sorted(l2)
    if ll1==ll2:
        return 1
    else:
        return 0
     # You can modify or delete this line

# === DO NOT modify the code below ===
def main():
    s1 = input()
    s2 = input()
    print(1 if isAnagram(s1, s2) else 0)
    
if __name__ == '__main__':
    main()
# === DO NOT modify the code above ===